<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" inline>
      <el-form-item label="状态">
        <el-radio-group v-model="form.status" @change="search">
          <el-radio-button :value="0"> 待审核 </el-radio-button>
          <el-radio-button :value="200">已审核</el-radio-button>
          <el-radio-button :value="500">已拒绝</el-radio-button>
        </el-radio-group>
      </el-form-item>

      <br />
      <el-form-item label="所属月份">
        <el-date-picker
          v-model="form.belongs_month"
          class="filter-item"
          type="month"
          value-format="YYYY-MM"
          style="width: 200px"
          @change="search"
        />
      </el-form-item>
      <el-form-item label="费用日期">
        <el-date-picker
          v-model="form.belongs_date"
          class="filter-item"
          type="date"
          value-format="YYYY-MM-DD"
          style="width: 200px"
          @change="search"
        />
      </el-form-item>
      <el-form-item label="所属车队">
        <el-input
          clearable
          style="width: 170px"
          v-model.trim="form.company"
          placeholder="请输入"
        />
      </el-form-item>

      <el-form-item label="所属区域">
        <el-input
          clearable
          style="width: 170px"
          v-model.trim="form.cate"
          placeholder="请输入"
        />
      </el-form-item>

      <el-form-item label-width="16px">
        <el-button type="primary" @click="search">查询</el-button>
        <el-button @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { useFormData } from '@/utils/use-form-data';

  const emit = defineEmits(['search']);

  const props = defineProps({
    where: {
      type: Object
    },
    badgeData: Object
  });
  /** 表单数据 */
  const [form, resetFields] = useFormData({
    company: '',
    belongs_month: '',
    belongs_date: '',
    site_id: '',
    tenant_id: 0,
    status: props.where.status
  });

  /** 搜索 */
  const search = () => {
    console.log(form);
    emit('search', { ...form });
  };

  /**  重置 */
  const reset = () => {
    resetFields();
    search();
  };
</script>
